namespace SimpleWebServices
{
    using System;
    using Xunit;

    public sealed class DateTimeFactoryFacts
    {
        [Fact]
        public void typedef()
        {
            Assert.True(typeof(DateTimeFactory).IsStatic());
        }

        [Fact]
        public void prop_Today_getMock()
        {
            DateTime? expected = DateTime.UtcNow;

            DateTimeFactory.Mock = expected;

            DateTime actual = DateTimeFactory.Today;

            Assert.Equal<DateTime>(expected.Value.Date, actual);
        }

        [Fact]
        public void prop_UtcNow_getMock()
        {
            DateTime? expected = DateTime.UtcNow;

            DateTimeFactory.Mock = expected;

            DateTime actual = DateTimeFactory.UtcNow;

            Assert.Equal<DateTime>(expected.Value, actual);
        }

        [Fact]
        public void prop_Mock_get()
        {
            DateTimeFactory.Mock = null;

            Assert.False(DateTimeFactory.Mock.HasValue);
        }

        [Fact]
        public void prop_Mock_set()
        {
            DateTime? expected = DateTime.Today;

            DateTimeFactory.Mock = expected;

            DateTime? actual = DateTimeFactory.Mock;

            Assert.Equal<DateTime?>(expected, actual);
        }

        [Fact]
        public void op_Reset()
        {
            DateTimeFactory.Mock = DateTime.Today;

            DateTimeFactory.Reset();

            Assert.False(DateTimeFactory.Mock.HasValue);
        }
    }
}